<%@page pageEncoding="UTF-8" %>
<!doctype html>
<html lang="zh-cmn">
<head>
    <title>Document</title>
    <%@include file="/WEB-INF/jsp/header.jsp"%>
</head>
<body>
<div class="container-fluid">


    <div class="panel panel-success">
        <div class="panel-heading">
            <h3 class="panel-title">条件查询</h3>
        </div>
        <div class="panel-body">
            <form id="DestoryForm" class="form-inline" action="">
                <div class="form-group">
                    <label for="">
                        销毁单号
                    </label>
                    <input type="text" name="desNum" class="form-control" />
                </div>
                <div class="form-group">
                    <label for="">
                        销毁状态
                    </label>
                    <select name="desState" style="width: 140px;" class="form-control">
                        <option value="-1">==全部==</option>
                        <option value="1">已销毁</option>
                        <option value="0">待销毁</option>
                    </select>
                </div>
                <div style="margin-top: 15px;"></div>
                <div class="form-group">
                    <label for="">
                        销毁日期
                    </label>
                    <input type="text" name="startDate" class="form-control" />-<input type="text" name="endDate" class="form-control" />
                </div>
                <button class="btn btn-primary" onclick="searchDestory()" type="button">搜索</button>
            </form>
        </div>
    </div>
    <table id="DestoryTable"
        data-toggle="table"
        data-url="${ctx}/stock/searchRecord"
        data-striped="true"
        data-pagination="true"
        data-side-pagination="server"
        data-page-list="[5,10,15,30]"
    >
        <thead>
            <tr>
                <th data-field="desNum">销毁单号</th>
                <th data-field="desDate">销毁日期</th>
                <th data-field="desUnit">报损单位</th>
                <th data-field="desMode">销毁方式</th>
                <th data-field="desSubdate">提交日期</th>
                <th data-field="desState" data-formatter="optState">销毁状态</th>
                <th data-formatter="optEvent" data-events="optEvents">操作</th>
            </tr>
        </thead>
    </table>
</div>

<%@include file="/WEB-INF/jsp/footer.jsp"%>
<script>

    var msg = '${msg}'
    if(msg!=null && msg!=''){
        toastr.info(msg);
    }
    window.optEvents = {
        "click .showDetail":function (e,value,row) {
            location.href=ctx+"/stock/SeeDestory?desNum="+row.desNum;
        }
    }
    //条件搜索
    function searchDestory() {
        var param={};
        param.desNum = $("#DestoryForm [name=desNum]").val();
        param.startDate = $("#DestoryForm [name=startDate]").val();
        param.endDate = $("#DestoryForm [name=endDate]").val();
        param.desState = $("#DestoryForm [name=desState]").val();

        $("#DestoryTable").bootstrapTable("refresh",{query:param})
    }
    //操纵
    function optEvent() {
        return '<button type="button" class="layui-btn layui-btn-mini showDetail" >查看</button>'
    }
    //状态
    function optState(event) {
        return event==0?"待销毁":"<span style='color:green;font-weight: bold'>已销毁</span>";
    }
    //搜索日期插件
    $(function () {
        laydate.render({
            elem:'[name=startDate]'
        })
        laydate.render({
            elem:'[name=endDate]'
        })
    });
</script>
</body>
</html>
